import type { MockMethod } from "vite-plugin-mock";

export default[
{
  url:'/api/logout',
  method:'post',
  response: () => {
    return {
      code: 200,
      message: '退出成功'
    };
  }
},
  {
    url: '/api/login',
    method: 'post',
    response: ({ body }) => {
      const { username, password } = body;
      if (username === 'admin' && password === 'wl123456') {
        return {
          code: 200,
          data: {
            token: 'admin-token',
            userInfo: {
              name: '管理员',
              avatar: 'https://example.com/avatar.png'
            }
          }
        };
      } else {
        return {
          code: 401,
          message: '用户名或密码错误'
        };
      }
    }
  },
  {
    url: '/api/getHomeData',
    method:'get',
    response: () => {
      return {
        code: 200,
        data: {
          pieData:[
            {value: 335, name: '直接访问'},
            {value: 310, name: '邮件营销'},
            {value: 234, name: '联盟广告'},
            {value: 135, name: '视频广告'},
            {value: 2008, name: '搜索引擎'}
          ],
          lineData:[55, 20, 364, 10, 100, 20],
          barData:[5, 200, 36, 100, 10, 20],
        }
      }
    }
  },
  {
    url: '/api/list',
    method: 'post',
    response: () => {
      return {
        "code": 200,
        "message": "成功",
        "data": {
          "trademarkList": [
            {
              "tmId": 1,
              "tmName": "苹果"
            },
          ],
          "attrsList": [
            {
              "attrId": 1,
              "attrValueList": [
                "4500-11999",
                "2800-4499"
              ],
              "attrName": "价格"
            },
          ],
          "goodsList": [
            {
              "id": 2,
              "defaultImg": "http://192.168.200.128:8080/xxx.jpg",
              "title": "Apple iPhone 11 (A2223)",
              "price": 5499,
              "createTime": null,
              "tmId": null,
              "tmName": null,
              "category1Id": null,
              "category1Name": null,
              "category2Id": null,
              "category2Name": null,
              "category3Id": null,
              "category3Name": null,
              "hotScore": 0,
              "attrs": null
            },
          ],
          "total": 8,
          "pageSize": 2,
          "pageNo": 1,
          "totalPages": 4
        },
        "ok": true
      }
    }
  }
] as MockMethod[]
